﻿using FluentNHibernate.Mapping;
using TimeTracker.Core.Domain.Entities;

namespace TimeTracker.Core.Domain.Mappings
{
    public class KorisnikMappings : ClassMap<Korisnik>
    {
        public KorisnikMappings()
        {
            Table("Korisnik");

            Id(x => x.KorisnikId).GeneratedBy.Identity();
            Map(x => x.KorisnickoIme);
            Map(x => x.Lozinka);
            Map(x => x.Email);
            Map(x => x.Opis);
            Map(x => x.Nivo);
            Map(x => x.Aktivan);

            References(x => x.Radnik)
                .ForeignKey("Id")
                .Column("RadnikId")
                .LazyLoad();
        }
    }
}
